import BaseSprite from "../../../Script/Base/BaseSprite";
import { EResType } from "../../../Script/Common/Enum";
import { LoadUtil } from "../../../Script/Util/LoadUtil";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ItemChat extends BaseSprite {

    @property({ type: cc.Sprite, tooltip: "icon" })
    private icon: cc.Sprite = null;

    @property({ type: cc.Label, tooltip: "value" })
    private labValue: cc.Label = null;

    @property({ type: cc.Label, tooltip: "name" })
    private labName: cc.Label = null;

    public async setData(data: { itemId: number, value: number, name: string }) {
        this.labName.string = `${data.name}`;
        this.labValue.string = `${data.value}`;
        LoadUtil.instance.setSpriteFrame(this.icon, EResType.Item, data.itemId, 90, 90);
    }
}